
function calculateScore(cleaning_coverage_rate) {
    if (cleaning_coverage_rate >= 0.9) {
        return 1;
    } else {
        var diff = 0.9 - cleaning_coverage_rate;
        var deduction = Math.min(diff * 10, 1);
        return Number((1 - deduction).toFixed(2));
    }
}

function calculate(number_of_violent_cases) {
    return number_of_violent_cases;
}

function calculate(area_of_secondary_hospitals, total_area) {
    var score = area_of_secondary_hospitals / total_area;
    return Number((score).toFixed(2));
}

function calculate(number_of_high_altitude_throwing_accidents, last_year_accidents) {
    return {
        "last_year_accidents":last_year_accidents,
        "number_of_high_altitude_throwing_accidents":number_of_high_altitude_throwing_accidents
    };
}

function calculate(death_toll_from_fire, total_number_of_city_people, last_year_fire_rate) {
    var score = death_toll_from_fire / total_number_of_city_people;
    return {
        "last_year_fire_rate":last_year_fire_rate,
        "annual_fire_rate":Number((score).toFixed(2))
    }
}

function calculate(total_number_of_doctors, total_number_of_nurses, number_of_medical_beds, resident_population) {
    return {
        "number_of_doctors":Number((total_number_of_doctors / resident_population).toFixed(2)),
        "number_of_nurses":Number((total_number_of_nurses / resident_population).toFixed(2)),
        "number_of_medical_beds":Number((number_of_medical_beds / resident_population).toFixed(2))
    }
}
